<div class="form form-horizontal">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'banner-form',
	'enableAjaxValidation'=>false,
    'htmlOptions'=>array('enctype'=>'multipart/form-data'),
)); ?>

	<div class="alert alert-info">
        <!-- <a class="close" data-dismiss="alert">×</a> -->
        Fields with <span class="required">*</span> are required.
    </div><!-- /Form filling tips -->

	<?php echo CHtml::errorSummary(
		$model,
		'<a class="close" data-dismiss="alert">×</a><h4 class="alert-heading">Please fix the errors below:</h4>',
		'',
		array('class'=>'alert alert-error',)
	); ?><!-- /Form error summary -->

	<div class="control-group<?php echo ($form->error($model, 'order')) ? ' error' : ''; ?>">
		<?php echo $form->labelEx($model, 'order', array('class'=>'control-label')); ?>
		<div class="controls">
			<?php echo $form->textField($model, 'order', array('size'=>6, 'maxlength'=>2, 'class'=>'input-mini')); ?>
			<?php echo $form->error($model, 'order', array('class'=>'help-inline')); ?>
		</div>
	</div>

	<div class="control-group<?php echo ($form->error($model, 'name')) ? ' error' : ''; ?>">
		<?php echo $form->labelEx($model, 'name', array('class'=>'control-label')); ?>
		<div class="controls">
			<?php echo $form->textField($model, 'name', array('size'=>60, 'maxlength'=>64, 'class'=>'input-xlarge')); ?>
			<?php echo $form->error($model, 'name', array('class'=>'help-inline')); ?>
		</div>
	</div>

	<div class="control-group<?php echo ($form->error($model, 'url')) ? ' error' : ''; ?>">
		<?php echo $form->labelEx($model, 'url', array('class'=>'control-label')); ?>
		<div class="controls">
			<?php echo $form->textField($model, 'url', array('size'=>60, 'maxlength'=>64, 'class'=>'input-xlarge')); ?>
			<?php echo $form->error($model,'url', array('class'=>'help-inline')); ?>
		</div>
	</div>
	
	<div class="control-group<?php echo ($form->error($model, 'desc')) ? ' error' : ''; ?>">
		<?php echo $form->labelEx($model, 'desc', array('class'=>'control-label')); ?>
		<div class="controls">
			<?php echo $form->textArea($model, 'desc', array('rows'=>3, 'class'=>'input-xlarge')); ?>
			<?php echo $form->error($model,'desc', array('class'=>'help-inline')); ?>
		</div>
	</div>

	<div class="control-group<?php echo ($form->error($model, 'thumb')) ? ' error' : ''; ?>">
		<?php echo $form->labelEx($model,'thumb', array('class'=>'control-label')); ?>
		<div class="controls">
			<?php $this->widget('application.extensions.swfupload.SwfuploadWidget',
				array(
					'debug'=>Yii::app()->params['swfuplaodDebug'], // Debug mode
					'use_query_string'=>false,
					'upload_url'=>$this->createUrl('bannerPicture/upload'),
					'post_params'=>array(
						'PHPSESSID'=>session_id(), 
					),
					'file_size_limit'=>'2 MB',
			        'file_types'=>'*.jpg;*.png;*.gif',
			        'file_types_description'=>'Image Files',
			        'file_upload_limit'=>100,
			        'file_queue_limit'=>0,

			        // Events defined in handler.js
			        'file_queued_handler'=>'js:fileQueued',
			        'file_queue_error_handler'=>'js:fileQueueError',
			        'file_dialog_complete_handler'=>'js:fileDialogComplete',
			        'upload_start_handler'=>'js:uploadStart',
			        'upload_progress_handler'=>'js:uploadProgress',
			        'upload_error_handler'=>'js:uploadError',
			        'upload_success_handler'=>'js:uploadSuccess',
			        'upload_complete_handler'=>'js:uploadComplete',
			        //'queue_complete_handler'=>'js:queueComplete',

			        'custom_settings'=>array(
			        	'progressTarget'=>'fsUploadProgress',
			        ),
			        'button_placeholder_id'=>'swfupload',
			        'button_width'=>170,
			        'button_height'=>20,
			        'button_action'=>-100,
				)
			); ?>
		    <span class="swfupload btn"><span id="swfupload"></span></span>
			<div id="fsUploadProgress"></div>
	        <?php echo $form->error($model, 'thumb', array('class'=>'help-inline')); ?> 
		</div>
	</div>

	<div class="form-actions">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('class'=>'btn btn-large btn-primary')); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->
